package cn.tedu.charging.common.pojo;

import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class JsonResult <T> {
    Integer code;
    String message;
    T data;

    public static JsonResult ok(Object data,String msg){
        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode(2000);
        jsonResult.setData(data);
        jsonResult.setMessage(msg);
        return jsonResult;
    }

    public static JsonResult ok(Object data) {
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode(2000);
        jsonResult.setData(data);
        return jsonResult;
    }
}
